<%@tag pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<div align="right">
	<script type="text/javascript">
	var LODOP; //声明为全局变量test
	var expressRex="";//运单号正则表达式
	var packformName="";
	var printName="";//打印机名称
	var status="";
	var expressStyleCur="";//快递模板
	function hideMessage(){
	  $(function() {
				setTimeout(function() {
						$("#message").hide();
					}, 3000);
			});
	}
	function alreadyMyChecked(item) {
		if ($("#check_already" + item).is(":checked")) {

		} else {
			$("#alreadyMyCheckedAll").attr("checked", false);
		}
	}
	function alreadyMyCheckedAll() {
		$("input[name='alreadyMyChecked']").attr("checked",
				$("#alreadyMyCheckedAll").is(":checked"));
	}

	function alreadyMyCheckedAllTWS() {
		var tempChecked = "";
		$("input[type='checkbox'][name='alreadyMyChecked']:checked").each(function() {
		     if(tempChecked==""){
		        tempChecked=$(this).val();
		     }else{
		       tempChecked = tempChecked + ":" + $(this).val();
		     }
		});
		return tempChecked;
	}
	
	 //修改订单的快递单打印状态
	 function ajaxPrintExpressOrdeno(ordeno,expressNo,companyCode) {
			$.ajax({
				type : 'post',
				url : '${ctx}/print/ajaxPrintExpressOrdeno',
				data : {
					ordeno:ordeno,
					expressNo:expressNo,
					companyCode:companyCode
				},
				dataType : 'json',
				success : function(data) {
					if(data.status=="1"){
					}else{
						alert("打印机发送指令失败");
					}
				},
				error : function() {
					alert("服务器异常3");
				}
			});
		}
	
	function printExpress(taskName,printerName,content,width,height,rankno,expressNo,ordeno,companyCode) {
		LODOP.PRINT_INIT(taskName);
		LODOP.SET_PRINT_PAGESIZE(1,width,height,""); 
		//LODOP.ADD_PRINT_TEXT(20,20,300,20,rankno);
		//LODOP.ADD_PRINT_BARCODE(10, 200, 180, 40, "128B", expressNo);
		eval(content);
		if (LODOP.SET_PRINTER_INDEXA(printerName)) {
			var fa=LODOP.PRINT();
			if(fa){
				ajaxPrintExpressOrdeno(ordeno,expressNo,companyCode);
			}
		}
	}

	function verify(content) {
		var result =content.match(expressRex);
		if(result==null){
		  return false;
		}
		return true;
	}


	function initLodop() {
	}

	

	function getBodyContentString(content) {
		content = content.replace(/<[^>]*?>(.*?)/gi, '='); //删除左部
		content = content.replace(/(.*?)<\/[^>]*?>/gi, '='); //删除右部
		var bodyContents = content.split("=");
		return bodyContents;
	}

function valSize(item,url){
	
	 if('${fn:length(orderList)}'=='0'){
	    $("#message").html("您没有要打印的订单");
	    $("#message").show();
	    hideMessage();
	   $(item).attr("href","ss");
	   return false;
	 }else{
	   $(item).attr("href","#"+url);  
	 }
	
	     var orders=alreadyMyCheckedAllTWS();
	      var length=orders.split(":").length;
	       if(orders==""){
	          $("#message").html("请选择订单");
	          $("#message").show();
	          hideMessage();
	          $(item).attr("href","ss");
	          return false;
	       }
	      $(item).attr("href","#"+url);  
	      if(url=="printAllPackFormStyle"){
	 		 packFormPrinter("packFormStylePrint");
	 		 status="packForm";
	 		 $("#myModalLabel").html("订单打印:共打印订单("+length+")单");
	       }else if(url=="printGuarantee"){
	       	 	packFormPrinter("guaranteeStylePrint");
	       	 	status="guarantee";
	       	 	$("#guaranteeLabel").html("订单打印:共打印订单("+length+")单");
	       }else if(url=="printPickInfo"){
	       		packFormPrinter("pickPickPrint");
	       }else{
              doGetPrinters();
	 		  status="mail" == $("#billType").val() ? "ebillExpress" : "express";
	 		  $("#expressLabel").html("订单打印:共打印订单("+length+")单");
	 	   }
	
	  $("#printer").removeAttr("disabled");
	  $("#firstExpressNumber").val("");
	  $("#firstExpressNumber").focus();
	  //电子单，隐藏单号
	  if(status == "ebillExpress"){
	  	$("#startWaybillNODiv").attr("style","display:none;");
	  }
	  ajaxExpressStyle();
	 
	 return true;
}

//整除
function Div(exp1, exp2){
    var n1 = Math.round(exp1); //四舍五入
    var n2 = Math.round(exp2); //四舍五入
    var rslt = n1 / n2; //除
    if (rslt >= 0){
        rslt = Math.floor(rslt); //返回值为小于等于其数值参数的最大整数值。
    }else {
        rslt = Math.ceil(rslt); //返回值为大于等于其数字参数的最小整数。
    }
    return rslt;
}



function pageAjaxPrinter(needExpressCompany){
    if(needExpressCompany){
        var styleBillType = expressStyleCur.type=='mail' ? 1:0;
        var taskType = "${workTask.billType}"=='ebill' ? 1:0;
        if(expressStyleCur.logisticsCompany.companyCode!="${workTask.companyCode}" || styleBillType!=taskType){
            var desc = "打印模板与任务模板不一致<br>";
            desc += "打印模板为:<font color='red'>"+expressStyleCur.logisticsCompany.companyCode+"</font>  类型:<font color='red'>"+(styleBillType==1?"电子面单":"普通面单")+"</font><br>";
            desc += "任务模板为:<font color='red'>"+"${workTask.companyCode}"+"</font>  类型:<font color='red'>"+(taskType==1?"电子面单":"普通面单")+"</font><br>";
            desc += "确认要打印吗?";
            jConfirm(desc,"温馨提示",function(r){if(r){doPageAjaxPrinter(needExpressCompany);}});
        }else{
            doPageAjaxPrinter(needExpressCompany);
        }

    }else {
        return;
    }
}

function doPageAjaxPrinter(needExpressCompany){
	var esiValue = $("#expressStylesId").val();
	if(needExpressCompany && !esiValue){
		jAlert("请选择快递单");
		return;
	}
    var orders=alreadyMyCheckedAllTWS();
	if(orders==""){
		$("#message").html("请选择订单");
		$("#message").show();
		hideMessage();
		return;
	}
	var expressStylesId = $("#expressStylesId").val();//快递单样式

	if("ebillExpress" == status){
		printName=$("#expressPrint").val();
		ajaxPrintEBillExpress(orders,expressStylesId,"${taskCode}");
	}
}

function ajaxPrintPackFormOrdenos(ordenos,packformStyleId){
 showBg();
$.ajax({
			type : 'post',
			url : '${ctx}/print/ajaxPrintPackFormOrdenosNew',
			data : 'ordenos=' + ordenos+'&packformStyleId='+packformStyleId+'&workTaskId='+"${workTask.id}",
			dataType : 'json',
			success : function(data) {
				 if (data.status == "1") {
					initLodop();
					$.each(data.content, function(i) {
						 printStyle(packformName,data.content[i].taskName,printName,data.content[i].content,data.content[i].ordeno,data.content[i].expressNo,data.content[i].taskName,
								 data.content[i].customerCode,data.content[i].printerLoGo);
					});
					
					 /***bug554 beigin remove by zhangweize  2016-10-31*************/
					/*  ajaxWorkTaskPackFormStatus("${workTask.id}");  */
					 /***bug554 end remove by zhangweize  2016-10-31*************/
				    $("#message").html("<span class=\"label label-success\">打印机加载完毕</span>");
				      closeBg();
				} else if (data.status == "-3") {
			    	closeBg();
					alert("请输入正确的运单号！");
				} else if (data.status == "0") {
				    closeBg();
					alert("加载错误！");
				}

			},

			error : function() {
                alert("服务器异常");
			}
		});
}
function ajaxWorkTaskPackFormStatus(item) {
		$.ajax({
			type : 'post',
			url : '${ctx}/print/ajaxWorkTaskPackFormStatus',
			data : 'workIds=' + item,
			dataType : 'json',
			success : function(data) {
			},
			error : function() {
				alert("服务器异常");
			}
		});
	}

function ajaxPrintPackExpressOrdenos(ordenos,firstExpress,expressId){
 showBg();
$.ajax({
			type : 'post',
			url : '${ctx}/print/ajaxPrintPackExpressOrdenos',
			data : 'ordenos=' + ordenos+'&firstExpress='+firstExpress+'&expressId='+expressId,
			dataType : 'json',
			success : function(data) {
				 if (data.status == "1") {
					initLodop();
					$.each(data.content, function(i) {
						
						    var str=data.content[i].content;
						    str=str.replace(/\r\n|\n|\r/g,"");
						printExpress(data.content[i].taskName,printName,str,data.width,data.height,data.content[i].taskName,data.content[i].expressNo,data.content[i].ordeno,data.content[i].companyCode);
						
					});
				    $("#message").html("<span class=\"label label-success\">打印机加载完毕</span>");
				       closeBg();
				} else if (data.status == "-3") {
			    	closeBg();
					alert("请输入正确的运单号！");
				} else if (data.status == "0") {
				    closeBg();
					alert(data.content);
				}

			},

			error : function() {

			}
		});
}

   function printStyle(indentfy,taskName, printerName, printContent,ordeno, expressNo,rankno,customerCode,printerLoGo){
      
          printFivePackStyle(taskName,printerName,printContent,ordeno,expressNo,rankno,customerCode,printerLoGo);
      
   }
   
   function printFivePackStyleHS1(taskName, printerName, printContent, ordeno,expressNo,
			rankno) {
		LODOP.PRINT_INIT(taskName);
		LODOP.ADD_PRINT_TEXT(10, 10, 200, 20, rankno);

		var strCenterStyle = "<style/>table {width:100%}</style>";
		LODOP.ADD_PRINT_HTM(30, 0, "100%", "100%", strCenterStyle
				+ printContent);
		LODOP.ADD_PRINT_BARCODE(10, 50, 380, 40, "128B", ordeno);
		LODOP.ADD_PRINT_BARCODE(650, 280, 200, 20, "128B", expressNo);
		if (LODOP.SET_PRINTER_INDEXA(printerName)) {
			LODOP.PRINT();
		}
	}
   
   function printFivePackStyleLove(taskName, printerName, printContent,oraden, expressNo,rankno) {
		LODOP.PRINT_INIT(taskName);
		LODOP.ADD_PRINT_TEXT(20,20,300,10,rankno);
		
		LODOP.ADD_PRINT_BARCODE(40, 20, 180, 40, "128B", oraden);
		LODOP.ADD_PRINT_BARCODE(40, 250, 180, 40, "128B", expressNo);
		var strCenterStyle = "<style/>table {width:100%}</style>";
		LODOP.ADD_PRINT_HTM(80, 0, "100%", "100%", strCenterStyle
				+ printContent);
		if (LODOP.SET_PRINTER_INDEXA(printerName)) {
			LODOP.PRINT();
		}
	}
   
   function printFivePackStyleRy(taskName, printerName, printContent,ordeno, expressNo,rankno) {
		LODOP.PRINT_INIT(taskName);
		LODOP.ADD_PRINT_TEXT(20,20,300,10,rankno);
	
		var strCenterStyle = "<style/>table {width:100%}</style>";
		LODOP.ADD_PRINT_HTM(80, 0, "100%", "100%", strCenterStyle
				+ printContent);
	    LODOP.ADD_PRINT_BARCODE(40, 10, 180, 40, "128B", ordeno);
		LODOP.ADD_PRINT_BARCODE(40, 250, 180, 40, "128B", expressNo);
		if (LODOP.SET_PRINTER_INDEXA(printerName)) {
			LODOP.PRINT();
		}
	}

	function printFivePackStyle(taskName, printerName, printContent,ordeno, expressNo,rankno,customerCode,printerLoGo) {
		LODOP.PRINT_INIT(taskName);
		LODOP.SET_PRINT_PAGESIZE(2, 0, 0, "A5") ;
		var strCenterStyle = "<style/>table {width:100%}</style>";
		LODOP.ADD_PRINT_HTM(60, 0, "100%", "100%", strCenterStyle+ printContent);
		//LODOP.ADD_PRINT_BARCODE(60, 360, 150, 40, "128B", ordeno);
		eval(printerLoGo);//打印LoGo
		LODOP.ADD_PRINT_BARCODE(50, 560, 200, 50, "128B", ordeno);
	    //if(customerCode=="SUN"){
		//	LODOP.ADD_PRINT_BARCODE(480, 50, 0, 0, "128B", rankno);
		//}else{
		//	LODOP.ADD_PRINT_BARCODE(20, 10, 0, 0, "128B", rankno);
		//}
		////LODOP.ADD_PRINT_BARCODE(650, 280, 200, 20, "128B", expressNo);
		if (LODOP.SET_PRINTER_INDEXA(printerName)) {
			LODOP.PRINT();
		}
	}

	function printFourPackStyle(taskName, printerName, printContent,oraden, expressNo,rankno) {
		LODOP.PRINT_INIT(taskName);
		LODOP.ADD_PRINT_TEXT(20,20,300,10,rankno);
		
		LODOP.ADD_PRINT_BARCODE(40, 200, 300, 50, "128B", oraden);
		LODOP.ADD_PRINT_BARCODE(40, 830, 200, 40, "128B", expressNo);
		var strCenterStyle = "<style/>table {width:100%}</style>";
		LODOP.ADD_PRINT_HTM(80, 0, "100%", "100%", strCenterStyle
				+ printContent);
		if (LODOP.SET_PRINTER_INDEXA(printerName)) {
			LODOP.PRINT();
		}
	}

		function ajaxPrintguaranteeOrdenos(orders){
		printName = $("#guaranteeStylePrint").val();
		showBg();
		$.ajax({
			type : 'post',
			url : '${ctx}/print/ajaxPrintguaranteeOrdenos',
			data : {
				ordenos:orders
			},
			dataType : 'json',
			success : function(data) {
				if (data.status == "1") {
					$.each(data.workOrders,function(i,v){
							printGuarantee(v,printName);
						});
					closeBg();
					} else {
						closeBg();
					}
				 }
		});
	}

function printGuarantee(workOrder,printName){
		LODOP.PRINT_INIT(workOrder.order.ordeno);
		LODOP.SET_PRINT_PAGESIZE(1,2400,1399,""); 
		var height=0;
		LODOP.ADD_PRINT_TEXT(90,'120mm',140,40,workOrder.taskCode+"_"+workOrder.rankno);
		LODOP.ADD_PRINT_TEXT(120,'120mm',140,40,"商业");
		LODOP.ADD_PRINT_TEXT(120,'50mm',140,40,new Date().Format("yyyy-MM-dd hh:mm:ss"));
		var count = 0;
		var order = workOrder.order.orderItems;
		for(var i =0;i<order.length;i++){
			height = height+30;
			LODOP.ADD_PRINT_TEXT(200+height,'50mm',140,40,order[i].nam);
			LODOP.ADD_PRINT_TEXT(200+height,'120mm',140,80,order[i].des);
			LODOP.ADD_PRINT_TEXT(200+height,'140mm',140,40,order[i].qty);
			LODOP.ADD_PRINT_TEXT(200+height,'160mm',140,80,order[i].pri);
			LODOP.ADD_PRINT_TEXT(200+height,'180mm',140,40,(order[i].pri)*(order[i].qty));
			count+=(order[i].pri)*(order[i].qty);
		}
		LODOP.ADD_PRINT_TEXT(390,'150mm',40,40,count);
		LODOP.ADD_PRINT_TEXT(440,'50mm',40,40,"梁欣");
		LODOP.ADD_PRINT_TEXT(440,'100mm',40,40,"梁欣");
		LODOP.ADD_PRINT_TEXT(440,'120mm',250,100,"佛山市顺德区盈丰行网络科技有限公司");
		if (LODOP.SET_PRINTER_INDEXA(printName)) {
			LODOP.PRINT(); 
		}
	}
	
	function getAjaxExpress() {
       var expressStylesId = $("#expressStylesId").val();
       if(!expressStylesId){
    	   return;
       }
		$.ajax({
			type : 'post',
			url : '${ctx}/v2/expressPrinting/getAjaxExpress',
			data : 'expressStylesId=' + expressStylesId,
			dataType : 'json',
			success : function(data) {
				if (data.status == "1") {
					expressStyleCur=data.content;
					expressRex=data.content.logisticsCompany.regMailNo;
					if("MJZT" == data.content.logisticsCompany.companyCode){
						$("#firstExpressNumber").val("XN"+Math.round(Math.random()*8999999999+1000000000));
					}
				}  else if (data.status == "0") {
					alert("获取运单号正则表达式错误！");
				}
			},

			error : function() {

			}
		});
	}
	
	function getAjaxPackformStyle() {
		var packformStylesId = $("#packformStylesId").val();
		if (packformStylesId == "" || packformStylesId == null) {
			alert("还没有这个随箱单");
			return;
		}
		$.ajax({
			type : 'post',
			url : '${ctx}/v2/packformStyle/getAjaxPackformStyle',
			data : 'packformStylesId=' + $("#packformStylesId").val(),
			dataType : 'json',
			success : function(data) {
				if (data.status == "1") {

					packformName = data.name;
					//packStyleType = data.type;
				
				} else if (data.status == "0") {
					alert("获取随箱单信息错误！");
				}

			},
			error : function() {
				alert("服务器异常");
			}
		});
	}
function ajaxExpressStyle() {
		    var type=$("#billType").val();
		    if(type=="mail"){
		    	$("#startWaybillNODiv").attr("style","display:none;");  
		    }else{
		   		$("#startWaybillNODiv").attr("style","display:block;");  
		    }
		    if($("#billType").val() && "packForm"!=status && "guarantee"!=status){
		    	status="mail" == $("#billType").val() ? "ebillExpress" : "express";
		    }
			$.ajax({
				type : 'post',
				url : '${ctx}/v2/expressPrinting/ajaxExpressStyle',
				//data : 'companyCode=' + '${workTask.companyCode}'+'&areaGroupCode='+'${workTask.warehouseCode}'+'&customerCode='+'${workTask.customerCode}'+'&type='+type,
				data : 'companyCode=&areaGroupCode='+'${workTask.warehouseCode}'+'&customerCode='+'${workTask.customerCode}'+'&type='+type,
				dataType : 'json',
				success : function(data) {
					if (data.status == "1") {
						var temp="<option value=''></option>";
						$.each(data.content,function(i,obj){
						       temp+="<option value='"+obj.id+"'>"+obj.styleName+"</option>";
						       
						});
						$("[name='expressStylesId']").html(temp);
						$("[name='expressStylesId']").trigger("chosen:updated");
						getAjaxExpress();
					}
				},

				error : function() {

				}
			});
			
		}	
	//------------------------------打印拣货单--------------------------------------------
	function AjaxPagePrinter(){
		printName = $("#pickPickPrint").val();
		showBg();
		$.ajax({
			type : 'post',
			url : '${ctx}/carPickTask/printFastPickTask',
			data : {
				taskCode:'${taskCode}'
			},
			dataType : 'json',
			success : function(data) {
			   if(data.status == "1"){
				   printPickInfo(data.workTaskItemList,data.printFlag,data.picker);
				   closeBg();
			   }else{//bug 382 by zhangweize L540-L543
					alert(data.content);
					closeBg();
				}
			},
			error:function() {
				alert("网络繁忙，请稍后重试...");
				closeBg();
			}
		}); 
	}
	 function printPickInfo(taskItem,printFlag,picker){
			var taskCode = taskItem[0].taskCode;
			var adjustTop = 0;
		 	var adjustLeft = 0;
			var str = '';
			var num = 0;
			LODOP.PRINT_INIT(taskCode);
			//LODOP.ADD_PRINT_BARCODE((15+adjustTop)+"mm", (80+adjustLeft)+"mm", "45mm", "10mm", "128Auto", taskCode);
			LODOP.ADD_PRINT_BARCODE((10+adjustTop)+"mm", "65%", "45mm", "10mm", "128Auto", taskCode);
			str +="<table width='100%' cellpadding='0' cellspacing='0' align = 'center' border='1'>";
			str +="<thead>"
			str +="<tr><td colspan= '7' align = 'center'><h3>拣货单(任务编号："+taskCode+")&nbsp;&nbsp;第"+printFlag+"次打印</h3></td></tr>";
			str +="</thead>"
			str +="<tbody align = 'center'><tr><td colspan= '2'>仓库</td><td colspan= '2'>"+taskItem[0].warehouseCode+"</td></tr>";
			str += "<tr style='font-size:10pt'><td width='6%'>序号</td><td width='8%'>商家</td><td width='15%'>库位</td><td width='18%'>sku</td><td width='31%'>sku名称</td><td width='7%'>数量</td><td width='15%'>箱位指引</td></tr>";
			for(var i =0;i<taskItem.length;i++){
				/* var tmpSkuName='';
				tmpSkuName=taskItem[i].skuName;
				if(tmpSkuName.length>20){
					tmpSkuName=tmpSkuName.substr(0,15)+"..."
				}  */
				str +="<tr style='font-size:12pt' ><td>"+(i+1)+"</td><td>"+taskItem[i].customerCode+"</td><td>"+taskItem[i].stockCode+"</td><td>"+taskItem[i].sku+"</td><td>"
				+taskItem[i].skuName+"</td><td>"+taskItem[i].num+"</td><td>"+taskItem[i].allocationDetail+"</td></tr>";
				num += taskItem[i].num;
			}
			str +="</tbody>";
			str +="<tfoot align = 'center'><tr><td colspan= '5'></td><td>"+num+"</td><td>拣货人:"+picker+"</td></tr></tfoot>";
			str +="</table>";
			LODOP.SET_PRINT_PAGESIZE(1, 0, 0, $("#paperSizes").val()) ;
			//bug 382 by zhangweize L581 改成93%主要是防止分页的时候漏打。 
			//LODOP.ADD_PRINT_TABLE(30,0, "100%","100%",str);
			LODOP.ADD_PRINT_TABLE(10,0, "100%","93%",str);
			if (LODOP.SET_PRINTER_INDEXA($("#pickPickPrint").val())) {
				LODOP.PRINT(); 
			}
	   }
	/* function AjaxPagePrinter(){
		printName = $("#pickPickPrint").val();
		showBg();
		$.ajax({
			type : 'post',
			url : '${ctx}/pickTask/ajaxPrintPickInfo',
			data : {
				taskCode:'${taskCode}'
			},
			dataType : 'json',
			success : function(data){
				if(data.status == "1"){
					printPickInfo(data.taskItemList,data.workOrderList,printName,data.printFlag);
					closeBg();
				}else{
					alert("打印加载错误！");
				}
			}
		});
	}
	function printPickInfo(taskItem,workOrderList,printName,printFlag){
		var taskCode = taskItem[0].taskCode;
		var adjustTop = 0;
	 	var adjustLeft = 0;
		var str = '';
		var num = 0;
		LODOP.PRINT_INIT(taskCode);
		LODOP.ADD_PRINT_BARCODE((15+adjustTop)+"mm", (80+adjustLeft)+"mm", "45mm", "10mm", "128Auto", taskCode);
		str +="<table width='100%' cellpadding='0' cellspacing='0' align = 'center' border='1'>";
		str +="<tr><td colspan= '7' align = 'center'><h3>拣货单(任务编号："+taskCode+")&nbsp;&nbsp;第"+printFlag+"次打印</h3></td></tr>";
		str +="<tbody align = 'center'><tr><td colspan= '2'>仓库</td><td colspan= '2'>"+taskItem[0].warehouseCode+"</td></tr>";
		str += "<tr style='font-size:10pt'><td width='6%'>序号</td><td width='8%'>商家</td><td width='15%'>库位</td><td width='15%'>箱位</td><td width='18%'>sku</td><td width='31%'>sku名称</td><td width='7%'>数量</td></tr>";
		for(var i =0;i<taskItem.length;i++){
			var tmpSkuName='';
			tmpSkuName=taskItem[i].skuName;
			if(tmpSkuName.length>20){
				tmpSkuName=tmpSkuName.substr(0,15)+"..."
			}
			str +="<tr style='font-size:12pt' ><td>"+(i+1)+"</td><td>"+taskItem[i].customerCode+"</td><td>"+taskItem[i].stockCode+"</td><td>"+taskItem[i].boxCode+"</td><td>"+taskItem[i].sku+"</td><td>"
			+tmpSkuName+"</td><td>"+taskItem[i].num+"</td></tr>";
			num += taskItem[i].num;
		}
		str +="</tbody>";
		str +="<tfoot align = 'center'><tr><td colspan= '6'><h4>拣货单(任务编号："+taskCode+")</h4></td><td>"+num+"</td></tr></tfoot>";
		str +="</table>";
		LODOP.SET_PRINT_PAGESIZE(1, 0, 0, "A5") ;
		LODOP.ADD_PRINT_TABLE(30,0, "100%","100%",str);
		if (LODOP.SET_PRINTER_INDEXA(printName)) {
			LODOP.PRINT(); 
		}
		//美的打印拣货清单
		if("MID"==taskItem[0].customerCode){
			printPickDetailInfo(workOrderList,taskCode,printName);
		}
	}
	function printPickDetailInfo(workList,taskCode,printName){
		LODOP.PRINT_INIT(taskCode);
		var adjustTop = 0;
	 	var adjustLeft = 0;
		var str = '';
		str +="<table width='100%' cellpadding='0' cellspacing='0' align = 'center' border='1'>";
		str +="<tr><td colspan= '4' align = 'center'><h3>拣货清单(任务编号："+taskCode+")</h3></td></tr>";
		str += "<tbody><tr style='font-size:10pt'><td width='6%'>序号</td><td width='47%'>任务号</td><td width='22%'>商品名</td><td width='25%'>sku</td></tr>";
		for(var i =0;i<workList.length;i++){
			var itemSize = workList[i].voItem.length;
			str +="<tr style='font-size:10pt' ><td rowspan='"+itemSize+"'>"+(i+1)+"</td><td rowspan='"+itemSize+"'>"+workList[i].taskCode+"</td>";
			for(var j =0;j<itemSize;j++){
				str +="<td>"+workList[i].voItem[j].goodName+"</td><td>"+workList[i].voItem[j].skuAndqty.split(":")[0]+"("+workList[i].voItem[j].skuAndqty.split(":")[1]+")</td></tr>";
			}
		}
		str +="</tbody>";
		str +="<tfoot align = 'center'><tr><td colspan= '4'><h4>拣货清单(任务编号："+taskCode+")</h4></td></tr></tfoot>";
		str +="</table>";
		LODOP.SET_PRINT_PAGESIZE(1, 0, 0, "A5") ;
		LODOP.ADD_PRINT_TABLE(30,0, "100%","100%",str);
		if (LODOP.SET_PRINTER_INDEXA(printName)) {
			LODOP.PRINT(); 
		}
	} */
</script>
</div>
<div id="fullbg"></div>
<div id="dialog">
	<div>
		<img src="${ctx }/static/022.gif"></img>
	</div>
</div>



<script type="text/javascript">
$("#printer").click(function(){
$("#printer").attr("disabled", "disabled");
  pageAjaxPrinter();
});
	if("express"=='${status}'){
	  
	}
	//getAjaxExpress();
	//getAjaxPackformStyle();
</script>
<div class="row">
	<div>
		<a href="#printAllPackFormStyle" role="button" data-toggle="modal"
			class="btn btn-primary" onclick="valSize(this,'printAllPackFormStyle');"
			style="margin-left: 20px;">打印随箱单</a>
		
		<a href="#printWorkBatchExpress" role="button" data-toggle="modal"
			class="btn btn-primary" onclick="valSize(this,'printWorkBatchExpress');"
			style="margin-left: 20px;">打印面单</a>
			
		<a href="#printPickInfo" role="button" data-toggle="modal"
			class="btn btn-primary" onclick="valSize(this,'printPickInfo');"
			style="margin-left: 20px;">打印拣货单</a>
			
	</div>

</div>




   <div class="modal fade"
			tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
			aria-hidden="true" id="printAllPackFormStyle">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<h3 id="myModalLabel">
		                                                        打印随箱单信息
						</h3>
						<span id="messageLable"></span>
					</div>
					<div class="modal-body">
						<div class="form-group row">
						    <div class="col-sm-9">
								<div class="input-group col-sm-12">
									<span class="input-group-text">   选择打印机: </span> 
									<select id="packFormStylePrint" name="packFormPrinter" class="form-control">
									</select>
								</div>
							</div>
						</div>
						
						<div class="form-group row">
						    <div class="col-sm-9">
								<div class="input-group col-sm-12">
									<span class="input-group-text">   选择随箱单:</span> 
									<select id="packformStylesId" name="packformStyleId" onchange="getAjaxPackformStyle();" class="form-control">
										<c:forEach items="${packformStyles}" var="obj">
											<option value="${obj.id}">
												${obj.styleName}
											</option>
										</c:forEach>
									</select>
								</div>
							</div>
						</div>
					</div>
		
					<div class="modal-footer">
						<a class="btn btn-primary" data-dismiss="modal" aria-hidden="true"
							onclick="pageAjaxPrinter()"> 立即打印 </a>
						<a class="btn" data-dismiss="modal" aria-hidden="true"> 关闭 </a>
					</div>
					
				</div>
			</div>
		</div>
		
		
		
		
<div class="modal fade"
			tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
			aria-hidden="true" id="printWorkBatchExpress">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<h3 id="expressLabel">
		                                                    打印快递单单信息
						</h3>
						<span id="messageLable"></span>
					</div>
					<div class="modal-body">
						<div class="form-group row">
						    <div class="col-sm-9">
								<div class="input-group col-sm-12">
									<span class="input-group-text">   选择打印机: </span> 
									<select id="expressPrint" name="packFormPrinter" class="form-control">
									</select>
								</div>
							</div>
						</div>
						
						<div class="form-group row">
						    <div class="col-sm-9">
								<div class="input-group col-sm-12">
									<span class="input-group-text">   选择单类型: </span> 
									<select id="billType" name="billType" onchange="ajaxExpressStyle()" class="form-control">
										<option value=''></option>
										<option value='mail'>电子面单</option>
										<option value='normal'>普通面单</option>
									</select>
								</div>
							</div>
						</div>
						
						<div class="form-group row">
						    <div class="col-sm-9">
								<div class="input-group col-sm-12">
									<span class="input-group-text">   选择快递单: </span> 
									<select id="expressStylesId" name="expressStylesId" onchange="getAjaxExpress();" class="form-control">
									</select>
								</div>
							</div>
						</div>
						
						<div class="form-group row"  id="startWaybillNODiv">
						    <div class="col-sm-9">
								<div class="input-group col-sm-12">
									<span class="input-group-text">    起始运单号: </span> 
									<input type="text" id="firstExpressNumber" class="form-control" />
								</div>
							</div>
						</div>

					</div>
		
					<div class="modal-footer">
						<a class="btn btn-primary" data-dismiss="modal" aria-hidden="true"
							onclick="pageAjaxPrinter('needExpressCompany')"> 立即打印 </a>
						<!-- onclick="pageAjaxPrinter('needExpressCompany')"> 立即打印 </a> -->
						<a class="btn" data-dismiss="modal" aria-hidden="true"> 关闭 </a>
					</div>
					
				</div>
			</div>
		</div>


<div class="modal  fade"
			tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
			aria-hidden="true" id="printGuarantee">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<h3 id="guaranteeLabel">
		                                                        打印保修单信息
						</h3>
						<span id="messageLable"></span>
					</div>
					<div class="modal-body"  style="overflow: auto;">
						<div class="form-group row">
						    <div class="col-sm-9">
								<div class="input-group col-sm-12">
									<span class="input-group-text">   选择打印机: </span> 
									<select id="guaranteeStylePrint" name="packFormPrinter" class="form-control">
		
									</select>
								</div>
							</div>
						</div>
					</div>
		
		               <div class="modal-footer">
						<a class="btn btn-primary" data-dismiss="modal" aria-hidden="true"
							onclick="pageAjaxPrinter()"> 立即打印 </a>
						<a class="btn" data-dismiss="modal" aria-hidden="true"> 关闭 </a>
					</div>
					
				</div>
			</div>
		</div>
<div class="modal  fade"tabindex="-1" role="dialog" aria-labelledby="myModalLabel"	aria-hidden="true" id="printPickInfo">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<h3 id="myModalLabel">
		                                                        打印拣货单信息
						</h3>
						<span id="messageLable"></span>
					</div>
					<div class="modal-body" style="overflow: auto;">
						<div class="form-group row">
						    <div class="col-sm-9">
								<div class="input-group col-sm-12">
									<span class="input-group-text">   选择打印机: </span> 
									<select id="pickPickPrint" name="packFormPrinter" class="form-control">
		
									</select>
								</div>
							</div>
						</div>
						<div class="form-group row">
							<div class="col-sm-9">
								<div class="input-group col-sm-12">
										<span class="input-group-text"> 纸张尺寸: </span> 
										<select id="paperSizes" name="paperSizes" class="form-control"  >
											<option value="A4" selected="selected" >A4</option>
											<option value="A5" >A5</option>
										</select>
								</div>
							</div>
						</div>
					</div>
					
		               <div class="modal-footer">
						<a class="btn btn-primary" data-dismiss="modal" aria-hidden="true" onclick="AjaxPagePrinter()"> 立即打印 </a>
						<a class="btn" data-dismiss="modal" aria-hidden="true"> 关闭 </a>
					  </div>
		  	</div>
		  </div>
		</div>

